package com.kevin.Code.DP;

/**
 * @author Vinlee Xiao
 * @Classname LongestContinuousIncreasingSubsequence
 * @Description Leetcode 674. 最长连续递增序列 简单 非动态规划思路
 * @Date 2021/10/5 15:02
 * @Version 1.0
 */
public class LongestContinuousIncreasingSubsequence {

    public static void main(String[] args) {
        LongestContinuousIncreasingSubsequence longestContinuousIncreasingSubsequence = new LongestContinuousIncreasingSubsequence();
        int[] nums = new int[]{1, 3, 5, 7};
        int i = longestContinuousIncreasingSubsequence.findLengthOfLCIS(nums);
        System.out.println(i);

    }


    /**
     * @param nums
     * @return
     */
    public int findLengthOfLCIS(int[] nums) {

        int len = nums.length;

        if (len == 1) {
            return 1;
        }


        int result = Integer.MIN_VALUE;
        int count = 1;
        for (int i = 1; i < len; i++) {

            if (nums[i] > nums[i - 1]) {
                count++;
            } else {
                result = Math.max(count, result);
                count = 1;
            }
        }
        result = Math.max(count, result);

        return result;
    }
}
